package wchen.dubbo.service;


import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

import java.util.concurrent.CountDownLatch;

@EnableAutoConfiguration
@SpringBootApplication(scanBasePackages = "wchen.dubbo.service")
public class WchenDubboServiceApplication {
	@Bean
	public CountDownLatch closeLatch() {
		return new CountDownLatch(1);
	}
	public static void main(String[] args) {
		try {
			ApplicationContext ctx = new SpringApplicationBuilder()
                    .sources(WchenDubboServiceApplication.class).banner(null)
                    .web(true)
                    .run(args);
			//线程堵塞
			CountDownLatch closeLatch = ctx.getBean(CountDownLatch.class);
			closeLatch.await();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

	}
}
